<template>
  <div  style="position: relative;">
    <mmTable ref="mmTable" :mmColumns="columns" :getUrl="url" :updateUrl="updateUrl" :delUrl="delUrl"
             :form="form" :formData="formData" v-on:formDataChange="formDataChange"
             :searchFormData="searchFormData" :searchForm="searchForm"
             :modalWidth="700">
      <Form slot="searchForm" ref="searchForm" :model="searchFormData" inline :label-width="70"  style="float: left">
        <FormItem label="用户名" prop="">
          <Input v-model="searchFormData.name" type="text" placeholder="" />
        </FormItem>
      </Form>
      <Form  slot="editForm" :label-width="150" :model="formData" inline ref="editForm" :rules="formValidate">

        <Row>
          <Col :span="24">
          <FormItem label="编号" prop="code" style="width:500px">
            <Input v-model="formData.code" type="text"  />
          </FormItem>
          </Col>
        </Row>
        <Row>
          <Col :span="24">
          <FormItem label="名称" prop="name" style="width:500px">
            <Input v-model="formData.name" type="text"  />
          </FormItem>
          </Col>
        </Row>

        <Row>
          <Col :span="24">
          <FormItem label="备注" prop="memo" style="width:500px">
            <Input v-model="formData.memo" type="textarea"  />
          </FormItem>
          </Col>
        </Row>
      </Form>
    </mmTable>
  </div>
</template>

<script>
import mmTable from '../components/mmtable/mmtable.vue'
export default {
  components: {
    mmTable
  },
  data () {
    return {
      columns: [
        { title: '编号', key: 'code', width: 200, align: 'center' },
        { title: '名称', key: 'name', width: 200, align: 'center' },
        { title: '备注', key: 'memo', align: 'left' }
      ],
      url: '/Doc/Company/getList',
      updateUrl: '/Doc/Company/Save',
      delUrl: '/Doc/Company/Delete',
      form: {},
      formValidate: {
      },
      searchForm: {},
      searchFormData: {
        code: '',
        name: ''
      },
      formData: {
        code: '',
        name: '',
        id: ''
      },
      searchFormData: {
        name: ''
      },
      searchForm: {}
    }
  },
  mounted () {
    this.form = this.$refs.editForm
    this.searchForm = this.$refs.searchForm
  },
  methods: {
    formDataChange (data) {
      this.formData = data
    }
  }
}
</script>

<style>

</style>
